<template>
  <tr>
    <td v-for="item in header" :key=item.prop :style="{color: item.color&&one[item.prop]>0 ? 'red': ''}" :class="item.tooltip ? 'ellipsis-wrap': ''">
      <el-tooltip
        effect="dark"
        :content="one[item.prop].toString()"
        placement="top"
        v-if="item.tooltip"
      >
        <div class="ellipsis">{{one[item.prop]}}</div>
      </el-tooltip>
      <template v-else>
        {{one[item.prop]}}
      </template>
    </td>
  </tr>
</template>
<script>
  export default {
    name: 'trCommon',
    data () {
      return {
      }
    },
    props: {
      one: {type: Object, default: function () { return {} }},
      header: {type: Array, default: function () { return [] }}
    },
    methods: {
    },
    beforeMount () {
    }
  }
</script>
<style lang="stylus" scoped>
  .ellipsis
    text-overflow ellipsis
    overflow hidden
    white-space nowrap
    max-width 100%
    display inline-block
  .ellipsis-wrap
    max-width 400px
</style>
